@isTest
private class SMSPrepareControllerTest {
    static testMethod void testMethod1() {
        Province__c pro = TestUtils.createProvince();
        insert pro;

        City__c c = TestUtils.createCity();
        c.Province__c = pro.Id;
        insert c;

        Account acc = TestUtils.createAccount();
        acc.Province__c = pro.Id;
        acc.City__c = c.Id;
        insert acc;

        Contact con = new Contact();
        con.LastName = 'zhang';
        con.MobilePhone = '123456789';
        con.AccountId = acc.Id;
        con.Post__c = 'Engineer';
        con.Departments__c = '医院办公室';
        con.SpecialTeam__c = '生化';
        insert con;

        SMSPrepareController sms = new SMSPrepareController();
        sms.init();

        //------------检索联系人---------------
        sms.con.AccountId = acc.Id;
        sms.con.Departments__c = '医院办公室';
        sms.con.SpecialTeam__c = '生化';
        sms.con.Post__c = 'Engineer';
        sms.acc.Province__c = pro.Id;
        sms.acc.City__c = c.Id;
        sms.searchContact();

        System.assertEquals(1, sms.cbList.size());

        //------------选择联系人---------------
        sms.cbList[0].chk = true;
        sms.selectContact();

        System.assertEquals(1, sms.selectedList.size());

        //------------选择短信模板---------------
        SMSTemplate__c tmp = new SMSTemplate__c();
        tmp.Name = 'new year';
        tmp.Type__c = 'new year';
        tmp.Body__c = '{ContactName}, happy new year';
        insert tmp;

        smsApi__c api = TestUtils.createSmsApic();
        insert api;

        sms.tmp.Type__c = 'new year';
        sms.verifyTemplate();
        sms.sendSms();
    }
}